//
//  HX_Areas.m
//  09-省市区
//
//  Created by 韩旭 on 16/7/26.
//  Copyright © 2016年 lanou. All rights reserved.
//

#import "HX_Areas.h"
#import "Model.h"
#import "HX_Model.h"

@interface HX_Areas ()<UITableViewDataSource, UITableViewDelegate>
@property (nonatomic, strong) NSMutableArray *arr;
@property (nonatomic, strong) UITableView *tableView;

@end

@implementation HX_Areas
- (void)viewDidLoad {
    [super viewDidLoad];
    _arr = [NSMutableArray array];
    self.navigationItem.title = @"区";
    self.view.backgroundColor = [UIColor whiteColor];
    self.tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kWidth, kHeight) style:UITableViewStylePlain];
    self.tableView.backgroundColor = [UIColor whiteColor];
    [self creatArray];
    _tableView.delegate = self;
    _tableView.dataSource = self;
    [self.view addSubview:_tableView];
}
- (void)creatArray {
    for (NSDictionary *dic in _arrAreas) {
        HX_Model *model = [[HX_Model alloc] initWithDic:dic];
        [_arr addObject:model];
    }
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
    return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return _arr.count;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    static NSString *ID = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
    if (!cell) {
        cell = [[UITableViewCell alloc] initWithStyle:3 reuseIdentifier:ID];
    }
    HX_Model *model = self.arr[indexPath.row];
    cell.textLabel.text = model.AreaNames;
    cell.backgroundColor = [UIColor whiteColor];
    return cell;
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
